
% Color
\newcommand{\mycola}{Purple}
\newcommand{\mycolb}{Mahogany}
\newcommand{\mycolc}{OliveGreen}

% \newcommand{\cola}[1][]{\textcolor{\mycola}{#1}}
% 🦜 : ⚠️ : For this we need to use \cola[hi] instead of \cola{hi}...

\newcommand{\cola}[1]{\textcolor{\mycola}{#1}}
\newcommand{\colb}[1]{\textcolor{\mycolb}{#1}}
\newcommand{\colc}[1]{\textcolor{\mycolc}{#1}}
\newcommand{\colz}[1]{\textcolor{gray}{#1}}
\newcommand{\Cola}[1]{\textcolor{\mycola}{\textbf{#1}}}

\usepackage{tikz}
\usetikzlibrary{shapes} % ellipse node shape
\usetikzlibrary{shapes.multipart} % for line breaks in node text
\usetikzlibrary{arrows.meta}    %-o arrow head
\usetikzlibrary{arrows}
\usetikzlibrary{matrix}

\usepackage{amsmath}

\usepackage{minted}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{minted}
\tcbuselibrary{breakable}

\usepackage{fontspec}
\setmonofont{Cascadia}[
Path=/usr/local/share/fonts/truetype/CascadiaCode/,
Scale=0.85,
Extension = .ttf,
UprightFont=*Code,              %find CascadiaCode.ttf
BoldFont=*CodePL,               %find CascadiaCodePL.ttf ...
ItalicFont=*CodeItalic,
BoldItalicFont=*CodePLItalic
]
\usepackage{amsmath}

\usepackage{minted}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbuselibrary{minted}


% Without this, there's a gap between the upper bbox and the node box

\newcommand{\makeSimpleListing}[2]{
  \newtcblisting{#1}{
    listing engine=minted,
    minted language=#2,
    minted style=vs,
    minted options={fontsize=\small,autogobble,
      breaklines=true,
      breakanywhere=true
      % framesep=1cm
    },
    tile,
    listing only,
    % bottom=0cm,
    % nobeforeafter,
    boxsep=0mm,
    left=1mm,
    opacityback=0.5,
    colback=gray!20,
    breakable
  }
}

% pygmentize -L lexers
\makeSimpleListing{simplec}{c++}
\makeSimpleListing{simplepy}{python}
\makeSimpleListing{simpleyml}{yaml}
\makeSimpleListing{simplesh}{bash}
\makeSimpleListing{simplecf}{cfg}
\makeSimpleListing{simplexml}{xml}
\makeSimpleListing{simplejv}{java}
\makeSimpleListing{simplejs}{js}
\makeSimpleListing{simplesol}{solidity}


\tcbset{enhanced, fontupper=\small,
  % show bounding box
}



\newcommand{\myTwo}[2]{\texttt{#1}为\texttt{#2}}

\tcbset{right=1mm,halign=flush left}
\newtcolorbox{ifaceBox}[1][]{colframe=\mycola, nobeforeafter, 
  fontupper=\footnotesize, left=2mm, #1}

\newtcolorbox{varBox}[1][]{nobeforeafter, 
  fontupper=\footnotesize, left=0mm, #1}

\newtcolorbox{weakBox}[1][]{colframe=gray!80, nobeforeafter,
  fontupper=\footnotesize, left=0mm, #1}

\newtcolorbox{funcBox}[1][]{colframe=\mycolb, nobeforeafter, 
  fontupper=\footnotesize, left=0mm, #1}

\newtcolorbox{noteBox}[1][]{colframe=\mycolc, nobeforeafter, 
  fontupper=\footnotesize, left=0mm, #1}

\newtcbox{\libbox}[1][\mycala]{on line,
  arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black,
  boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,
  boxrule=0pt,bottomrule=1pt,toprule=1pt}

% copied from tcolorbox mannual
\newtcbox{\mylib}[1][\mycola]{on line,
  arc=0pt,outer arc=0pt,colback=#1!10!white,colframe=#1!50!black,
  boxsep=0pt,left=1pt,right=1pt,top=2pt,bottom=2pt,
  boxrule=0pt,bottomrule=1pt,toprule=1pt,
  left skip=0.1cm,
  right skip=0.1cm,
  fontupper=\ttfamily
}


% Redefine em
%latex.sty just do: \DeclareTextFontCommand{\emph}{\em}

\let\emph\relax % there's no \RedeclareTextFontCommand
\DeclareTextFontCommand{\emph}{\bfseries\em}

% Redefine section
\usepackage[small]{titlesec}


% curve version
% \newcommand\uptoleft[2][]{\draw[very thick,->](#1.south) to [out=270,in=180] (#2.west);}

% right-angle version
\newcommand\uptoleft[3][-o]{\draw[very thick,#1](#2.south) |- (#3.west);}
\newcommand\uptodown[3][-o]{\draw[very thick,#1](#2.south) to [out=270,in=90] (#3.north);}
\newcommand\downtoup[3][-latex]{\draw[very thick,#1](#2.north) to [out=90,in=270] (#3.south);}

\newcommand\lefttoright[3][-latex]{\draw[very thick,#1](#2.east) to[out=0,in=180] (#3.west);}
\newcommand\lefttodown[3][-latex]{\draw[very thick,#1](#2.east) to[out=0,in=90] (#3.north);}
\newcommand{\mySection}[1]{\section*{\texttt{#1}}}

\tikzstyle{every node}=[inner sep=0pt]
\tikzstyle{iface}=[rectangle,fill=gray!30,inner sep=2mm]
\tikzstyle{myMatrix}=[matrix of nodes,below right,
nodes={right},                  %apply to all nodes
row sep=1cm,column sep=2cm]

% TREE NODE
\tikzstyle{myTreeNode}=[draw=\mycola,anchor=west,inner sep=2mm,rectangle,rounded corners,fill=gray!20]
\tikzstyle{edge from parent}=[draw=\mycola,thick,-latex]
\tikzstyle{every child node}=[myTreeNode]


\newenvironment{aBox}
  {
\begin{tcolorbox}[bicolor,sidebyside,
 lefthand width=0.8cm, tile,
  sharp corners,boxrule=.4pt,colback=gray!20,colbacklower=\mycolb!20,
  fontupper=\footnotesize,
  fontlower=\footnotesize,
  left=0cm,
  ]
\Bart{}
\tcblower{}
% \tcbfontsize{0.5}
}{\end{tcolorbox}}

\newenvironment{bBox}
  {
\begin{tcolorbox}[bicolor,sidebyside,
 lefthand width=0.8cm, tile,
  sharp corners,boxrule=.4pt,colback=gray!20,colbacklower=\mycola!20,
  fontupper=\footnotesize,
  fontlower=\footnotesize,
  left=0cm,
  ]
\Lisa{}
\tcblower{}
% \tcbfontsize{0.5}
}{\end{tcolorbox}}

\newenvironment{cBox}
  {
\begin{tcolorbox}[bicolor,sidebyside,
 lefthand width=0.8cm, tile,
  sharp corners,boxrule=.4pt,colback=gray!20,colbacklower=\mycola!20,
  fontupper=\footnotesize,
  fontlower=\footnotesize,
  left=0cm,
  ]
\SNPP{}
\tcblower{}
% \tcbfontsize{0.5}
}{\end{tcolorbox}}


\usepackage{tabularray}
\UseTblrLibrary{booktabs,siunitx}
\usepackage{placeins}